package kr.saeildamil.androidstudy_second.cp;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class WordDBHelper extends SQLiteOpenHelper {
	final static String TAG = "WordDBHelper";
	
	public WordDBHelper(Context context){
		super(context, "EngWord.db", null, 3);
	}
	
	public void onCreate(SQLiteDatabase db) {
		Log.d(TAG, "onCreate(SQLiteDatabase db)");
		String sql = 	"CREATE TABLE dic ( " +
						"_id INTEGER PRIMARY KEY AUTOINCREMENT, " +
						"eng Text, " +
						"han Text" +
						");";
		db.execSQL(sql);
	}

	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		Log.d(TAG, "onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)");
		String sql = "DROP TABLE IF EXISTS dic";
		db.execSQL(sql);
		onCreate(db);
	}

}
